TYBUILD=../../tybuild/bin/Release/tybuild.exe
TYSILA=../../tysila2/bin/Release/tysila2.exe

PECORLIB=mscorlib.dll
CORLIBOBJ=mscorlib.obj
ORIGSOURCES=corlib.dll.sources
SOURCESOPTIONS=corlib.dll.sources.options
SOURCELIST=corlib.dll.ty.sources
PETYSOS=../../tysos/bin/Release/tysos.exe

.PHONY: clean

all: $(CORLIBOBJ)

$(TYBUILD):
	cd ../../tybuild && make

$(TYSILA2):
	cd ../../tysila2 && make

$(PETYSOS):
	cd ../../tysos && make bin/Release/tysos.exe

$(SOURCELIST): $(ORIGSOURCES) $(SOURCESOPTIONS)
	cat $(SOURCESOPTIONS) > $(SOURCELIST)
	echo '#assemblyname $(PECORLIB)' >> $(SOURCELIST)
	echo '' >> $(SOURCELIST)
	cat $(ORIGSOURCES) >> $(SOURCELIST)

$(PECORLIB): $(SOURCELIST) $(TYBUILD)
	$(TYBUILD) /t $(SOURCELIST)

$(CORLIBOBJ): $(PECORLIB) $(PETYSOS)
	$(TYSILA) -o $(CORLIBOBJ) -q -c --unimplemented mscorlib-unimplemented.txt -L../../tysos/bin/Release $(PECORLIB)

clean:
	rm -rf $(PECORLIB) $(SOURCELIST)

